package com.ysk.testapplication;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ysk.testapplication.qcm.FillMoreMethod;
import com.ysk.testapplication.qcm.OnViewCreate;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * @author RQ
 * date    2022-01-27 17:09
 */
public class TestFragment extends BaseFragment implements OnViewCreate {
  @Nullable
  @Override
  public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                           @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fra_test, null);
    return root;
  }

  private volatile int size = 0;

  @Override
  public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    new Thread(() -> {
      while (size++ < 5_000) {
        try {
          Thread.sleep(1);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
        setData2View(R.id.tv_show, "data:" + size);
      }
    }).start();
  }

}
